/**
 *  @file
 *  @brief   槽（C）形1（CHAN1）梁截面属性使用数值方法计算类
 *  @author  Li Zhaoni
 *  @date    2024.07.22
 *  @version v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#include "Chan1SectionNumericalCalculator.h"

#include "DataStructure/Common/Real.h"

#include "ChanSectionNumericalCalculator.h"
#include "SectionCalculator/StandardSectionTool.h"

using SG::DataStructure::Common::Real;
using SG::DataStructure::FEM::PBARLData;
using SG::FEMSolver::Element::Chan1SectionNumericalCalculator;
using SG::FEMSolver::Element::ChanSectionNumericalCalculator;

void Chan1SectionNumericalCalculator::Mesh (const PBARLData& section, _OUT Meshes& meshes, int refineLevel) const
{
    /* NASTRAN 的 CHAN1 形梁截面转换成 CHAN 形梁截面
     *
     * chan.dim1 = chan1.dim1 + chan1.dim2
     * chan.dim2 = chan1.dim4
     * chan.dim3 = chan1.dim2
     * chan.dim4 = (chan1.dim4 - chan1.dim3) / 2
     * 详细请参考 NASTRAN 手册
     */
    Real      dim2{ section.m_dimension[3] };
    Real      dim3{ section.m_dimension[1] };
    Real      dim1{ dim3 + section.m_dimension[0] };
    Real      dim4{ 0.5 * (dim2 - section.m_dimension[2]) };
    PBARLData chanSection{ section };
    chanSection.m_dimension = { dim1, dim2, dim3, dim4 };
    ChanSectionNumericalCalculator ChanSecMesher;
    ChanSecMesher.Mesh (chanSection, _OUT meshes, refineLevel);
}